

           function addRow() {
               var grid = jQuery("#<%= JQGrid1.ClientID %>");
               grid.editGridRow("new", grid.addDialogOptions);
           }

           function editRow() {
               var grid = jQuery("#<%= JQGrid1.ClientID %>");
               var rowKey = grid.getGridParam("selrow");
               if (rowKey) {
                   grid.editGridRow(rowKey, grid.editDialogOptions);
               }
               else {
                   alert("No rows are selected");
               }
           }

           function delRow() {
               var grid = jQuery("#<%= JQGrid1.ClientID %>");
               var rowKey = grid.getGridParam("selrow");
               if (rowKey) {
                   grid.delGridRow(rowKey, grid.delDialogOptions);
               }
               else {
                   alert("No rows are selected");
               }
           }
       
         $.ajax({url: 'gridFunctions/manuimActions.php',
                                data: {manuy_row:null,
                                manuy_number:getSelectedCellManuim("manuy_number"),
                                create_2:'',
                                state:'מבוטל',
                                agent_person_number:<?php echo $_SESSION['person_number']; ?>,
                                person_number:getSelectedCellManuim("person_number"),
                                from_2:getSelectedCellManuim("from_2"),
                                until:getSelectedCellManuim("until"),
                                manufacturer:getSelectedCellManuim("manufacturer"),
                                model:getSelectedCellManuim("model"),
                                license_plate:getSelectedCellManuim("license_plate"),
                                production_year:getSelectedCellManuim("production_year"),
                                product_desc:getSelectedCellManuim("product_desc"),
                                product_price:getSelectedCellManuim("product_price"),
                                paymen_type:getSelectedCellManuim("paymen_type"),
                                agent_commission:parseInt(getSelectedCellManuim("agent_commission"))*(-1),
                                from_agent_commission:getSelectedCellManuim("from_agent_commission"),
                                total_payment:parseInt(getSelectedCellManuim("total_payment"))*(-1),
                                shulam:'0',
                                oper:'add'},
                                type: 'post',
                                success: function(output)
                                {
                                    jQuery("#manuimList").trigger('reloadGrid');
                                     if (output === "ok")
                                     alert("המנוי בוטל");
                                }
                            });	//end og ajax call
       


onSelectRow: function(rowid){
if (rowid==2) {
$("#save1").removeClass('ui-state-disabled'); //Enable 
} else {
$("#save1").addClass('ui-state-disabled'); //Disable 
}
},
        
        // all data for report
        SELECT * FROM manuy2client AS M,person AS P,person AS A,agent as AG  WHERE M.manuy_row=1 AND M.person_number=P.person_number AND M.agent_person_number=A.person_number AND A.person_number=AG.person_number
        
        // filtterd
        SELECT M.manuy_number,M.total_payment,A.lastname,A.firstname,A.person_number,M.from_2,M.until,P.lastname,P.firstname,P.city,P.address,P.person_id,manufacturer,M.model,M.license_plate,M.production_year,M.product_desc FROM manuy2client AS M,person AS P,person AS A,agent as AG  WHERE M.manuy_row=1 AND M.person_number=P.person_number AND M.agent_person_number=A.person_number AND A.person_number=AG.person_number